package com.fm.service.impl;

import com.fm.common.ResultResponse;
import com.fm.dao.FeedbackMapper;
import com.fm.pojo.Feedback;
import com.fm.service.IFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("feedbackService")
public class FeedbackServiceImpl implements IFeedbackService {

    @Autowired
    private FeedbackMapper feedbackMapper;

    public ResultResponse<String> addFeedback(Feedback feedback){
        int resultCount = feedbackMapper.insert(feedback);
        if(resultCount == 0){
            return ResultResponse.isErrorMessage("发送反馈失败");
        }
        return ResultResponse.isSuccessMessage("发送反馈成功");
    }

    public ResultResponse<String> delFeedback(String feedbackId){
        int resultCount = feedbackMapper.deleteByPrimaryKey(feedbackId);
        if(resultCount == 0){
            return ResultResponse.isErrorMessage("删除失败");
        }
        return ResultResponse.isSuccessMessage("删除成功");
    }

}
